package com.easyweb.session;

import com.easyweb.entity.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("bayiHome")
public class BayiHome extends EntityHome<Bayi> {

	@In(create = true)
	IlceHome ilceHome;
	@In(create = true)
	SemtlerHome semtlerHome;
	@In(create = true)
	IllerHome illerHome;

	public void setBayiId(BigDecimal id) {
		setId(id);
	}

	public BigDecimal getBayiId() {
		return (BigDecimal) getId();
	}

	@Override
	protected Bayi createInstance() {
		Bayi bayi = new Bayi();
		return bayi;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
		Ilce ilce = ilceHome.getDefinedInstance();
		if (ilce != null) {
			getInstance().setIlce(ilce);
		}
		Semtler semtler = semtlerHome.getDefinedInstance();
		if (semtler != null) {
			getInstance().setSemt(semtler);
		}
		Iller iller = illerHome.getDefinedInstance();
		if (iller != null) {
			getInstance().setIl(iller);
		}
	}

	public boolean isWired() {
		return true;
	}

	public Bayi getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

	 

}
